package com.jxb.test20241216;

/**
 * 类注释
 *
 * @author jiaobo
 * @date Created in 2024/12/23 1:46
 **/
public class Sort31 {

    public static void main(String[] args) {

    }

    public int[] sort(int[] arr) {
        for (int i = 1;i<arr.length;i++) {

            int preIndex = i-1;

            int currentValue = arr[i];

            while (preIndex >= 0 && arr[preIndex] < currentValue) {
                arr[preIndex+1] = arr[preIndex];
                preIndex--;
            }
            arr[preIndex+1] = currentValue;

        }
        return arr;
    }

}
